package com.lzw.service.impl.admin;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lzw.mapper.admin.MedicinesManage2Mapper;
import com.lzw.pojo.Medicines;
import com.lzw.service.admin.MedicinesManage2Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicinesManage2ServiceImpl implements MedicinesManage2Service {

    @Autowired
    private MedicinesManage2Mapper medicinesManage2Mapper;

    @Override
    public List<Medicines> list(Integer pageNum, Integer pageSize, String name, String batchNumber, String manufacturer, String supplier) {
        PageHelper.startPage(pageNum,pageSize);
        List<Medicines> list = medicinesManage2Mapper.list(name, batchNumber, manufacturer, supplier);
        Page<Medicines> medicines = (Page<Medicines>) list;
        return medicines;
    }

    @Override
    public void delete(List<Integer> ids) {
        medicinesManage2Mapper.delete(ids);
    }

    @Override
    public void add(Medicines medicines) {
        medicinesManage2Mapper.add(medicines);
    }

    @Override
    public void update(Medicines medicines) {
        medicinesManage2Mapper.update(medicines);
    }

    @Override
    public Medicines getById(Integer medicineId) {
        return medicinesManage2Mapper.getById(medicineId);
    }
}
